<% import grails.persistence.Event %>
<table>
                    <thead>
                        <tr>

                        <%  excludedProps = Event.allEvents.toList() << 'version'
                            props = domainClass.properties.findAll { !excludedProps.contains(it.name) && it.type != Set.class }
                            if(listItems){
                              Collections.sort(props, wcomparator.constructors[0].newInstance([domainClass, listItems] as Object[]))

                            }else{
                            Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
                            }
                            props.eachWithIndex { p, i ->

                                if (!listItems || listItems.find{item -> item.equals(p.name)} ) {
                                    if (p.isAssociation()) { %>
                            <th><g:message code="${domainClass.propertyName}.${p.name}.label" default="${p.naturalName}" /></th>
                   	    <%      } else { %>
                           <util:remoteSortableColumn property="${p.name}" title="\${message(code: '${domainClass.propertyName}.${p.name}.label', default: '${p.naturalName}')}" update="listContainer${domainClass.propertyName}" action="embedList"/>
                                                         <%  }   }   } %>
                         <% if(rowActions){%>
                            <th colspan="${rowActions.size()}"></th>
                        <% }  %>
                           <th></th>
                        </tr>

                    </thead>
                    <tbody>
                    <g:each in="\${${propertyName}List}" status="i" var="${propertyName}">
                        <tr class="\${(i % 2) == 0 ? 'odd' : 'even'}">
                        <%

                          props.eachWithIndex { p, i ->
                                cp = domainClass.constrainedProperties[p.name]
                                if (!listItems || listItems.find{item -> item.equals(p.name)}  ) {
                                    if (p.type == Boolean.class || p.type == boolean.class) { %>
                            <td><g:formatBoolean boolean="\${${propertyName}.${p.name}}" /></td>
                        <%          } else if (p.type == Date.class || p.type == java.sql.Date.class || p.type == java.sql.Time.class || p.type == Calendar.class) { %>
                            <td><g:formatDate date="\${${propertyName}.${p.name}}" /></td>
                        <%          } else if (p.isAssociation()) { %>
                            <td><g:each in="\${${propertyName}.${p.name}}" status="i_${p.name}" var="v_${p.name}" >
                               <g:if test="\${i_${p.name} < 4 }">
                                  \${v_${p.name}} ,
                               </g:if>
                            </g:each>
                            <g:remoteLink action="list${p.name}" update="div_data_\${${propertyName}.id}" id="\${${propertyName}.id}" after="new Effect.Appear('tr_data_\${${propertyName}.id}')">...</g:remoteLink>
                        </td>
                        <%          } else { %>
                            <td>\${fieldValue(bean: ${propertyName}, field: "${p.name}")}</td>
                        <%  }   }   } %>
                          <% if(rowActions){ rowActions.each{ ra -> %>
                             <td class="rowaction">
                                  <% if(ra.url) { %>
                                  <a href="${ra.url}">${ra.label}</a>
                                  <% } %>
                                  <% if(ra.action) { %>
                                  <g:link action="${ra.action}" <% if(ra.controller) { %> controller="${ra.controller}" <% } %> id="\${${propertyName}.id}" > <g:message code="${ra.label}" default="${ra.label}" />    </g:link>
                                   <% } %>
                              </td>
                                  <% }  %>
                                <% }%>

                              <td class="rowaction">
                              <g:link action="edit"  id="\${${propertyName}.id}">
                               <span class="rowactionedit"> \${message(code: 'default.button.edit.label', default: 'Edit')} </span>
                              </g:link>
                               <g:link action="delete"  id="\${${propertyName}.id}" onclick="return confirm('\${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
                                   <span class="rowactiondelete"> \${message(code: 'default.button.delete.label', default: 'Delete')} </span>
                              </g:link>

                              </td>


                        </tr>
                      <tr id="tr_data_\${${propertyName}.id}" style="display:none">
                       <td id="td_data_\${${propertyName}.id}" colspan="16">
                         <a href="#" onclick="new Effect.Fade('tr_data_\${${propertyName}.id}')">Close</a>
                         <div id="div_data_\${${propertyName}.id}"></div>
                       </td>
                      </tr>
                    </g:each>
                    </tbody>
                </table>
              <div class="paginateButtons">

              <util:remotePaginate  action="embedList" total="\${${propertyName}Total}"
                                   update="listContainer${domainClass.propertyName}" params="\${filterParams}"/>
            </div>